Calling a parameterized javascript function from php [migrated]
Posted
by
Ginger
on Programmers
See other posts from Programmers
or by Ginger
Published on 2012-06-07T08:22:43Z
Indexed on
2012/06/07
10:47 UTC
Read the original article
Hit count: 220
php
|JavaScript
I need to call a javascript function from php, by passing a value in php variable. My code goes like this:
echo '<tr class="trlight"><td onclick="callVehicle('.$qry_vehicleid.');"><label>Call Vehicle</label> </td></tr>';
And in javascript file I try to execute the following code:
function callVehicle(vid)
{
alert('Call '+vid);
document.getElementById("SearchResult").style.visibility="hidden";
}
and an error test is not defined
occurs. test
is the value that I assigned to variable $qry_vehicleid
. Can someone please point out what the mistake is?
© Programmers or respective owner